<?php
class FeedbookAction extends AdminAction {

	public function index(){
		$obj = M('Feedbook');
		$count = $obj->where($map)->count();
		import("@.ORG.Page");
		$page = new Page($count, 20);
		$show = $page->show();
		$list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
		$this->assign('list', $list);
		$this->assign('page', $show);
		$this->display();
	}

	public function view(){
		$id = (int) $_GET['id'];
		if (!isset ($id)) {
			$this->error('参数错误');
		}
		$obj = M('Feedbook');
		$list = $obj->where("id=$id")->find();

		if (!$list) {
			$this->error('信息不存在');
		} else {
			$this->assign('list', $list);
			$this->display();
		}
	}

	public function save(){
		$this->all_save('Feedbook',U('Feedbook/index'));
	}


	public function del(){	
		$id=I('post.selectedids');

		if($id==''){
			$state = "您没有选择任何信息！";
		}else{
			foreach ($id as $v) {
				$obj = M('Feedbook');
				$where['id'] = $v;
				$obj->where($where)->delete();
			}
			$state = 'SUCCESS';
	        $message = '删除成功';
	        $url = U('Feedbook/index');
		}
		echo $this->echo_json_str($state,$message,$url);
    }
}
?>